package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaiFoodMapper;
import com.ruoyi.system.domain.BaiFood;
import com.ruoyi.system.service.IBaiFoodService;

/**
 * 营养膳食Service业务层处理
 * 
 * @author saruri
 * @date 2024-07-20
 */
@Service
public class BaiFoodServiceImpl implements IBaiFoodService 
{
    @Autowired
    private BaiFoodMapper baiFoodMapper;

    /**
     * 查询营养膳食
     * 
     * @param id 营养膳食主键
     * @return 营养膳食
     */
    @Override
    public BaiFood selectBaiFoodById(Long id)
    {
        return baiFoodMapper.selectBaiFoodById(id);
    }

    /**
     * 查询营养膳食列表
     * 
     * @param baiFood 营养膳食
     * @return 营养膳食
     */
    @Override
    public List<BaiFood> selectBaiFoodList(BaiFood baiFood)
    {
        return baiFoodMapper.selectBaiFoodList(baiFood);
    }

    /**
     * 查询营养膳食上一条
     *
     * @param id 营养膳食主键
     * @return 营养膳食上一条
     */
    @Override
    public BaiFood selectBaiFoodPrevById(Long id)
    {
        return baiFoodMapper.selectPrevBaiFoodById(id);
    }


    /**
     * 查询营养膳食下一条
     *
     * @param id 营养膳食主键
     * @return 营养膳食下一条
     */
    @Override
    public BaiFood selectBaiFoodNextById(Long id)
    {
        return baiFoodMapper.selectNextBaiFoodById(id);
    }


    /**
     * 查询最新营养膳食
     *
     * @return 营养膳食
     */
    @Override
    public BaiFood selectBaiFoodNew()
    {
        return baiFoodMapper.selectBaiFoodNew();
    }

    /**
     * 新增营养膳食
     * 
     * @param baiFood 营养膳食
     * @return 结果
     */
    @Override
    public int insertBaiFood(BaiFood baiFood)
    {
        baiFood.setCreateTime(DateUtils.getNowDate());
        return baiFoodMapper.insertBaiFood(baiFood);
    }

    /**
     * 修改营养膳食
     * 
     * @param baiFood 营养膳食
     * @return 结果
     */
    @Override
    public int updateBaiFood(BaiFood baiFood)
    {
        return baiFoodMapper.updateBaiFood(baiFood);
    }

    /**
     * 批量删除营养膳食
     * 
     * @param ids 需要删除的营养膳食主键
     * @return 结果
     */
    @Override
    public int deleteBaiFoodByIds(Long[] ids)
    {
        return baiFoodMapper.deleteBaiFoodByIds(ids);
    }

    /**
     * 删除营养膳食信息
     * 
     * @param id 营养膳食主键
     * @return 结果
     */
    @Override
    public int deleteBaiFoodById(Long id)
    {
        return baiFoodMapper.deleteBaiFoodById(id);
    }
}
